package boot

import (
	"github.com/gogf/gf/v2/frame/g"
	"github.com/gogf/gf/v2/os/gctx"
	"github.com/gogf/gf/v2/os/gproc"
	"runtime"
)

func RunWebman() {
	go func() {
		sysos := runtime.GOOS
		//currentPath, _ := os.Getwd() // 获取当前路径
		//if sysos == "windows" {
		//	cmdStr := "php " + currentPath + "2\\windows.php"
		//	ctx := gctx.GetInitCtx()
		//	if err := gproc.ShellRun(ctx, cmdStr); err != nil {
		//		g.Dump("webman进程异常")
		//		panic(err)
		//	}
		//}
		if sysos == "linux" {
			cmdStr := "./bin/webman.bin start"
			ctx := gctx.GetInitCtx()
			if err := gproc.ShellRun(ctx, cmdStr); err != nil {
				g.Dump("webman进程异常")
				panic(err)
			}
		}
	}()
}
